'use strict';

angular.module('com.dcos.app').directive('myprogress',  function ($state) {
	return {
		restrict: 'EA',
		replace: true,
		scope: {
			
		},
		templateUrl: '../../directive/progress/mypg.html',
		link: function (scope, element,attrs) {
			scope.load = function(){
				var btn = $("#releaseBtn")[0];
				btn.innerHTML = "工作流运行测试完毕，点击发布至镜像仓库";
				new ProgressButton(btn, {
					callback : function( instance ) {
						var progress = 0,
						interval = setInterval( function() {
							progress = Math.min( progress + Math.random() * 0.1, 1 );
							instance._setProgress(progress);
							if( progress === 1 ) {
								instance._stop(1);
								clearInterval( interval );
							}
						}, 200);
					}
				} );
			}
			
			scope.load();
		}
	}
});